import axios from '@/utils/request';

const BASE_API = process.env.VUE_APP_BASE_API;
const DEVICE_API = process.env.VUE_APP_DEVICE_API;
const LOGIN_API = process.env.VUE_APP_LOGIN_API;

// 联系方式
const getContactInformation = () => {
    return axios.get(BASE_API + '/market/getContactInformation')
}

// 型号推荐
const getModelRecommend = () => {
    return axios.get(BASE_API + '/market/getModelRecommend')
}

// 行业推荐
const getIndustryRecommend = () => {
    return axios.get(BASE_API + '/market/getIndustryRecommend')
}

// 所有分类
const getAllGoodsType = () => {
    return axios.get(BASE_API + '/market/getAllGoodsType')
}

// 广告带
const getBannerList = (params) => {
    return axios.get(BASE_API + '/market/getBannerList', { params })
}

// 新闻列表
const getNewsList = (params) => {
    return axios.get(BASE_API + '/market/getNewsList', { params })
}

// 新闻详情
const getNewsDetail = (params) => {
    return axios.get(BASE_API + '/market/getNewsDetail', { params })
}

// 商品列表
const getGoodsList = (params) => {
    return axios.get(BASE_API + '/market/getGoodsList', { params })
}

// 商品详情
const getGoodsDetail = (params) => {
    return axios.get(BASE_API + '/market/getGoodsDetail', { params })
}

// 游客登录
const loginVisitor = (data) => {
    return axios.post(BASE_API + '/market/login', data)
}

// 客户登录
const loginCustomer = (data) => {
    return axios.post(LOGIN_API + '/user/login', data)
}

// 获取商品相关配件
const getModelAccessories = (params) => {
    return axios.get(DEVICE_API + '/device/getModelAccessories', { params })
}

export {
    getContactInformation,
    getModelRecommend,
    getIndustryRecommend,
    getAllGoodsType,
    getBannerList,
    getNewsList,
    getNewsDetail,
    getGoodsList,
    getGoodsDetail,
    getModelAccessories,
    loginCustomer,
    loginVisitor
}